Skip to content

Conversation

@dealfonso
Copy link
Contributor

@dealfonso dealfonso commented Mar 7, 2025

I found a lot of warnings related to "Implicitly marking parameter XXX as nullable is deprecated, the explicit nullable type must be used instead" when trying to use Phug in PHP8.4.

[Fri Mar  7 13:36:04 2025] PHP Deprecated:  Phug\Compiler::compileNode(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in /Users/user/Coding/.../vendor/phug/phug/src/Phug/Compiler/Compiler.php on line 502
...

The warnings have been corrected by marking explicitly as nullable those parameters that default to null.

The process was assisted by using Rector, with the following code:

return Rector\Config\RectorConfig::configure()
    ->withPaths([__DIR__ . '/src'])
    ->withPhpVersion(Rector\ValueObject\PhpVersion::PHP_84)
    ->withRules([ Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class, ]);

Fix #115

Copy link
Member

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙏

@kylekatarnls kylekatarnls merged commit fb0cff8 into phug-php:master Mar 7, 2025
1 of 40 checks passed
@dealfonso
Copy link
Contributor Author

Please create a new release to update packagist

@kylekatarnls
Copy link
Member

kylekatarnls commented Mar 8, 2025

This is a breaking change because it drops support for PHP < 7.1, it will go in the next major release. For now you can use composer require "phug/phug:2.x-dev as 1.999" to install it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

PHP8.4 implicit nullable is deprecated

2 participants